import { StyleSheet, Text, View, Button, Dimensions } from "react-native";
import React, { useState } from "react";
import { Radio } from "@ant-design/react-native";
import { router } from "expo-router";
import Api from '../Api/api'
export default function Anser() {
  const RadioItem = Radio.RadioItem;
  const radi = [
    { id: 1, name: "星形细胞瘤", value: "A" },
    { id: 2, name: "室管膜瘤", value: "B" },
    { id: 3, name: "脉络丛乳头状瘤", value: "C" },
    { id: 4, name: "髓母细胞瘤", value: "D" },
    { id: 5, name: "血管母细胞瘤", value: "E" },
  ];
  const [active, setactive] = useState("A");
  return (
    <View style={styles.container}>
      <Radio.Group onChange={(e) => setactive(e.target.value)} value={active}>
        {radi.map((item) => {
          return (
            <View key={item.id} style={styles.radiy}>
              <Radio value={item.value}>{item.name}</Radio>
            </View>
          );
        })}
      </Radio.Group>
      <Button
        title="提交答案"
        onPress={() => {
          router.push({
            pathname: "/YgFile/Answer",
            params: { active: active },
          });
        }}
      ></Button>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
  },
  radiy: {
    width: Dimensions.get("window").width,
    display: "flex",
    flexDirection: "row",
  },
});
